home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / batch / tsbat36.zip / REZIP.BAT < prev    next >
DOS Batch File  |  1992-03-17  |  5KB  |  161 lines

  1. echo off
  2. echo.
  3. echo ┌───────────────────────────────────────────────────────────┐
  4. echo │ Unzip and then zip again a .zip file to remove -av label  │
  5. echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Tue 17-03-1992    │
  6. echo └───────────────────────────────────────────────────────────┘
  7.  
  8. rem Advanced trick: If you want to use filecards after all use:
  9. rem   for %f in (*.zip) do call rezip %f
  10. rem You must have MsDos 3.30 or later to use this trick
  11.  
  12. rem If no parameters then give the instructions
  13. if "%1"=="" goto _help
  14.  
  15. rem Check that the zip file exists
  16. if not exist %1 goto _nofile
  17.  
  18. rem Check that there are no wild cards in the file name
  19. for %%f in (%1) do if "%%f"=="%1" goto _is_ask
  20. echo Wildcards are not allowed in %1
  21. goto _out
  22.  
  23. rem Check that the ask.exe program is available
  24. :_is_ask
  25. set _found=
  26. if exist ask.exe set _found=yes
  27. for %%d in (%path%) do if exist %%d\ask.exe set _found=yes
  28. if "%_found%"=="yes" goto _isunzip
  29. echo Timo's enhancer ask.exe must be at path or in the current directory
  30. goto _out
  31.  
  32. rem Check that the pkunzip.exe program is available
  33. :_isunzip
  34. set _found=
  35. if exist pkunzip.exe set _found=yes
  36. for %%d in (%path%) do if exist %%d\pkunzip.exe set _found=yes
  37. if "%_found%"=="yes" goto _ispkzip
  38. echo pkunzip.exe must be at path or in the current directory
  39. goto _out
  40.  
  41. rem Check that the pkzip.exe program is available
  42. :_ispkzip
  43. set _found=
  44. if exist pkzip.exe set _found=yes
  45. for %%d in (%path%) do if exist %%d\pkzip.exe set _found=yes
  46. if "%_found%"=="yes" goto _chk_r
  47. echo pkzip.exe must be at path or in the current directory
  48. goto _out
  49.  
  50. rem Check that there is a r: drive available
  51. :_chk_r
  52. if not exist r:\nul goto _noram
  53.  
  54. rem Make a temporary directory
  55. if not exist r:\tmp$$$\nul md r:\tmp$$$
  56.  
  57. :_isempty
  58. if not exist r:\tmp$$$\*.* goto _test
  59. echo The auxiliary directory r:\tmp$$$ is not empty
  60. :_ask1
  61. ask Delete the files (y/n)? /d /u
  62. if errorlevel==89 if not errorlevel==90 goto _del
  63. if errorlevel==78 if not errorlevel==79 goto _out
  64. goto _ask1
  65.  
  66. rem Delete files from r:\tmp$$$
  67. :_del
  68. del r:\tmp$$$\*.*
  69. goto _isempty
  70.  
  71. rem Test archive integrity
  72. :_test
  73. pkunzip -t %1
  74. if errorlevel==1 goto _unziperr
  75. goto _ask2
  76.  
  77. :_unziperr
  78. echo Error in %1
  79. ask Continue nevertheless (y/n)? /d /u
  80. if errorlevel==89 if not errorlevel==90 goto _ask2
  81. if errorlevel==78 if not errorlevel==79 goto _out
  82. goto _unziperr
  83.  
  84. :_ask2
  85. ask Old %1 will be deleted, ok (y/n)? /d /u
  86. if errorlevel==89 if not errorlevel==90 goto _pkunzip
  87. if errorlevel==78 if not errorlevel==79 goto _out
  88. goto _ask2
  89.  
  90. rem Unzip the .zip archive
  91. :_pkunzip
  92. pkunzip %1 r:\tmp$$$
  93. if not exist r:\tmp$$$\*.zip goto _ask3
  94. echo Warning: There are .zips within %1
  95. pause
  96.  
  97. :_ask3
  98. ask Insert e:\arczip\comment.txt as zip comment (y/n)? /d /u
  99. if errorlevel==89 if not errorlevel==90 goto _com_yes
  100. if errorlevel==78 if not errorlevel==79 goto _com_no
  101. goto _ask3
  102.  
  103. rem Check that the comment.txt file program is available
  104. :_com_yes
  105. if exist e:\arczip\comment.txt goto _with_com
  106. echo e:\arczip\comment.txt not found
  107. echo Adjust the path as necessary
  108. goto _out
  109.  
  110. rem Delete and make a new .zip archive with zip comment
  111. :_with_com
  112. del %1 > nul
  113. pkzip -br:\ -mu -o -z %1 r:\tmp$$$\*.* < e:\arczip\comment.txt
  114. goto _rd
  115.  
  116. rem Delete and make a new .zip archive without zip comment
  117. :_com_no
  118. del %1 > nul
  119. pkzip -br:\ -mu -o %1 r:\tmp$$$\*.*
  120. goto _rd
  121.  
  122. :_rd
  123. pkzip -v %1
  124. rd r:\tmp$$$
  125. goto _out
  126.  
  127. rem Error messages
  128. :_nofile
  129. echo File %1 not found
  130. goto _out
  131.  
  132. :_noram
  133. echo You must have a (ram)disk available as drive r:
  134. goto _out
  135.  
  136. :_help
  137. echo                      ┌──────────────┐
  138. echo Usage REZIP FileName │ No wildcards │ (paths are ok)
  139. echo                      └──────────────┘
  140. echo Since someone cracked the pkzip 1.10 authenticity (-av) code some BBSes
  141. echo have been putting in their own ads as the authenticity labels. The
  142. echo purpose of this batch is to remove these labels, which may give the
  143. echo users a false sense of security.
  144. echo Note that any .zips within the .zip will not be cleaned.
  145. echo.
  146. echo You will need the following shareware and PD programs to use this batch.
  147. echo They are available from good BBSes or from garbo.uwasa.fi by anonymous ftp.
  148. echo      PKUNZIP.EXE and PKZIP.EXE from PKZ110.EXE or PKZ110EU.EXE
  149. echo      ASK.EXE from TSBAT26.ARC
  150. echo.
  151. echo Advanced trick for MsDos 3.30+: To use wildcards apply:
  152. echo   for #f in (*.zip) do call rezip #f   (# stands for ascii 37)
  153. echo If you get an "Out of environment space" message, increase your
  154. echo environment space by using shell configuration in config.sys:
  155. echo MsDos 3.30 example: shell=c:\bin\command.com /e:1024 /p
  156. goto _out
  157.  
  158. :_out
  159. set _found=
  160. echo on
  161.